package com.pangolin.pangolinim.ui.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.pangolin.pangolinim.ui.base.BaseFragment;

import java.util.List;

public class CommonFragmentPagerAdapter extends FragmentStateAdapter {
    private List<BaseFragment> mFragments;
    public CommonFragmentPagerAdapter(FragmentActivity fragmentActivity, List<BaseFragment> fragments) {
        super(fragmentActivity);
        mFragments = fragments;
    }

    @Override
    public Fragment createFragment(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getItemCount() {
        return mFragments != null ? mFragments.size() : 0;
    }
}
